<template>
	<view>
		<view class="indexhed padding-right-lg">
			<!-- <view @tap="codeScan" class="scanBox">
				<u-icon name="scan" class="text-white text-xxl"></u-icon>
			</view> -->
		</view>
		<view class="margin margin-top-xxl boxShadow">
			<uni-grid :column="3" :square="false" :highlight="false":show-border="false">
				<uni-grid-item v-for="(item, index) in list" :index="index" :key="index">
					<view class="grid-item-box" @tap=turnList(item.text)>
						<image :src="item.url" class="image" mode="aspectFill" />
						<text class="text">{{ item.text }}</text>
					</view>
				</uni-grid-item>
			</uni-grid>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
						url: '/static/home_icon/order.png',
						text: '查询工单',
						badge: '0',
						type: "primary"
					},
					{
						url: '/static/home_icon/caiji-normal.png',
						text: '查询产品',
						badge: '1',
						type: "success"
					},
					{
						url: '/static/home_icon/caiji-select.png',
						text: '查询物料',
						badge: '99',
						type: "warning"
					}
					// {
					// 	url: '/static/home_icon/caiji-normal.png',
					// 	text: 'Grid 4',
					// 	badge: '2',
					// 	type: "error"
					// },
					// {
					// 	url: '/static/home_icon/caiji-normal.png',
					// 	text: 'Grid 5'
					// },
					// {
					// 	url: '/static/home_icon/caiji-normal.png',
					// 	text: 'Grid 6'
					// },
					// {
					// 	url: '/static/home_icon/caiji-normal.png',
					// 	text: 'Grid 7'
					// },
					// {
					// 	url: '/static/home_icon/caiji-normal.png',
					// 	text: 'Grid 8'
					// },
					// {
					// 	url: '/static/home_icon/caiji-normal.png',
					// 	text: 'Grid 9'
					// }
				]
			}
		},
		onLoad() {},
		methods: {
			turnList(name){
				uni.navigateTo({
					url: `/pages/list/list?name=${name}`
				})
			}
			// 扫描二维码
			// codeScan() {
			// 	// 只允许通过相机扫码
			// 	uni.scanCode({
			// 		onlyFromCamera: true,
			// 		success: function(res) {
			// 			uni.navigateTo({
			// 				url: `/pages/list/list?lotId=${res.result}`
			// 			})
			// 		}
			// 	});
			// }
		}
	}
</script>
<style lang="scss" scoped>
	.boxShadow{
		background-color:#fff;
		border-radius: 5rpx;
		box-shadow: 15rpx 15rpx 10rpx #ccc;
	}
	.uni-margin-wrap {
		width: 690rpx;
	}

	.swiper {
		height: 300rpx;
	}

	.swiper-item {
		display: block;
		height: 300rpx;
		line-height: 300rpx;
		text-align: center;
	}

	.swiper-list {
		margin-top: 40rpx;
		margin-bottom: 0;
	}

	.scanBox {
		width: 50rpx;
		height: 50rpx;
		margin-top: 70rpx;
		z-index: 999;
	}

	.indexhed {
		background-image: url(../../static/indexHead.png);
		background-size: cover;
		background-repeat: no-repeat;
		height: 300rpx;
		width: 100%;
		display: flex;
		flex-direction: row-reverse;

		.marginrightpre {
			margin-right: 6%;
		}

		.fontwhite {
			color: #fff;
		}

		.Imgbox {
			// padding: 0 30rpx;
			height: 300rpx;
			margin-top: 40rpx;
			border-radius: 10px;
			width: calc(100vw - 60rpx);
			// display: flex;
			// justify-content: center;
		}

		.showbox {
			width: 48%;
			height: 260rpx;
			background-color: #fff;
			margin-top: 30rpx;
			border-radius: 10px;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			image {
				width: 90rpx;
				height: 90rpx;
			}
		}

		.showboxchild {
			width: 30%;
			height: 210rpx;
			background-color: #fff;
			margin-top: 30rpx;
			border-radius: 10px;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			.greencolor {
				color: #0EBA77;
			}
		}
	}

	.text-xxxl {
		font-size: 200rpx;
	}

	.grid-item-box {
		flex: 1;
		// position: relative;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 15px 0;
	}

	.image {
		width: 25px;
		height: 25px;
	}

	.text {
		font-size: 14px;
		margin-top: 5px;
	}
</style>
